package algorithm;

public class ClimbStairs {
    public int climbStairs(int n) {
        if (n < 1) {
            return 0;
        }
        if (n == 1 || n == 2) {
            return n;
        }

        int a = 2;
        int b = 3;
        int sum = 3;
        for (int i = 4; i <=n; i++) {
            sum = a + b;
            a = b;
            b = sum;
        }

        return sum;
    }

    public static void main(String[] args) {

    }
}
